import { create } from "zustand";
import { immer } from "zustand/middleware/immer";

interface Data {
  id: number | string;
  name: string;
  chain: string;
  uploadWay: string;
}
type State = {
  inputRows: Data[];
};

type Actions = {
  setInputRows: (data: Data) => void;
  clean: () => void;
};

export const useInputLoadStore = create<State & Actions>()(
  immer((set) => ({
    inputRows: [],
    setInputRows: (data: Data) =>
      set((state) => {
        state.inputRows.push(data);
      }),
    clean: () =>
      set((state) => {
        state.inputRows = [];
      }),
  }))
);
